package com.shop.controller;

import java.util.*;

import com.shop.dto.MemberInfoDto;
import com.shop.dto.MemberLoginDto;
import com.shop.dto.MemberRegister;
import com.shop.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.shop.dto.MemberDto;

/**
 * 
 *
 * @author wzby
 * @date 2022-12-02 13:24:15
 */
@RestController
@RequestMapping("/api/member")

public class MemberController {

    @Autowired
    private MemberService memberService;

    @PostMapping("/login")
    public MemberInfoDto select(@RequestBody MemberLoginDto dto){
        return memberService.select(dto);
    }

    @PostMapping("/register")
    public Integer register(@RequestBody MemberDto dto) throws Exception {
        return memberService.register(dto);
    }

    @GetMapping("/vcode")
    public Integer  sendVCode(@RequestParam String email){
        return  memberService.sendVCode(email);
    }


    @PutMapping
    public Integer update(@RequestBody MemberDto dto){
        return  memberService.update(dto);
    }

    @DeleteMapping("/{id}")
    public Integer delete(@PathVariable  Integer id){
        return memberService.delete(id);
    }
}
